﻿using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace ModelLayer
{
    [DataContract]
    public class SeatBooking
    {
        [DataMember]
        public Seat Seat { get; set; }
        [DataMember]
        public bool CheckedIn{ get; set; }
        [DataMember]
        public FlightInstance FlightInstance { get; set; }
        [DataMember]
        public int SeatBookingId { get; set; }

        public SeatBooking()
        {
             
        }
        //Compares seat bookings based on their seat number and their flight instances 
        public override bool Equals(object _obj)
        {
            bool equal = false;
            SeatBooking objSeatBooking = (SeatBooking) _obj;
            if (Seat.Equals(objSeatBooking.Seat) && FlightInstance.Equals(objSeatBooking.FlightInstance))
            {
                equal = true;
            }
            return equal;
        }
        //Overrides the string representation of the object
        public override string ToString()
        {
            return string.Format("Seat number: {0} \n  Checked in: {1}", Seat.SeatNo, CheckedIn);
        }
    }
}
